package com.ht.controller;

import javax.servlet.http.HttpSession;

import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.ht.po.SysUser;

/**
 * 
 * 系统常用服务
 * @author Administrator
 *
 */
@Controller
public class AdminController {
	
	// 进入首页
	@RequestMapping("openIndex")
	public String openIndex(Model model) {
		Subject subject = SecurityUtils.getSubject();
		SysUser user = (SysUser) subject.getPrincipal();
		model.addAttribute("user", user);
		return "index";
	}
	
	// 无权访问
	@RequestMapping("openRefuse")
	public String openRefuse() {
		return "refuse";
	}
	
	
	// 用户退出
	@RequestMapping("exit")
	public String exit() {
		Subject subject = SecurityUtils.getSubject();
		subject.logout();
		return "redirect:openLogin";
	}
}
